from django.http import JsonResponse

from framework import Code


def response(message: str = 'success', code: int = Code.C_2_0, data: [dict, list] = None) -> JsonResponse:
    """
    fmt django response
    :param message:         描述信息
    :param code:            状态码
    :param data:            data
    :return: django response
    """
    return JsonResponse(
        {
            'message': message,
            'code': code,
            'data': data
        }
    )
